package oer.halk.intercept_demo.controller;

import oer.halk.intercept_demo.entity.User;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhuhao
 * @Date 2022/1/26 14:49
 * @desc
 */
@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(String user) {
        return "hello: " + user;
    }

    @PostMapping("/user")
    public User getUser(@Validated @RequestBody User user) {
        return user;
    }
}
